package com.nowcoder.config;

import com.nowcoder.quartz.PostScoreRefreshJob;
import com.nowcoder.quartz.TestJob;
import org.quartz.JobDataMap;
import org.quartz.JobDetail;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.quartz.JobDetailFactoryBean;
import org.springframework.scheduling.quartz.SimpleTriggerFactoryBean;

// @Configuration
// // 第一次启动生效
// public class QuartzConfig {
//
//     // 配置JobDetail
//     @Bean
//     public JobDetailFactoryBean postScoreRefreshJobDetail() {
//         JobDetailFactoryBean factoryBean = new JobDetailFactoryBean();
//         factoryBean.setJobClass(PostScoreRefreshJob.class); // 设置JOB在那里
//         factoryBean.setName("postJob");
//         factoryBean.setGroup("MainJob");
//         factoryBean.setDurability(true);
//         factoryBean.setRequestsRecovery(true);
//         return factoryBean;
//     }
//
//     // 配置Trigger(SimpleTriggerFactoryBean, CronTriggerFactoryBean)
//     @Bean
//     public SimpleTriggerFactoryBean alphaTrigger(JobDetail postScoreRefreshJobDetail) {
//         SimpleTriggerFactoryBean factoryBean = new SimpleTriggerFactoryBean();
//         factoryBean.setJobDetail(postScoreRefreshJobDetail);
//         factoryBean.setName("postTrigger");
//         factoryBean.setGroup("MainTrigger");
//         factoryBean.setRepeatInterval(1000 * 3);
//         factoryBean.setJobDataMap(new JobDataMap());
//         return factoryBean;
//     }
// }
